<!doctype html>
<html lang="zh-CN">
<head>
  <!-- 必须的 meta 标签 -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <!-- Bootstrap 的 CSS 文件 -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
  <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  <title>Hello, world!</title>
</head>
<body>
<div class="container-lg">

  <table class="table">
    <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col"></th>
      <th scope="col">题目</th>
      <th scope="col">通过率</th>
      <th scope="col">难度</th>
    </tr>
    </thead>
    <tbody>
    {assign name="index" value="0" /}

    {foreach $questionList as $key=>$question}
    <tr class="question">
      <th scope="row">{$index+=1}</th>
      <?php $href = "../editor?qid=" . $question->qid; ?>
      <td width="20px">
        {if($solveQuestionState[$index-1] == true)}
        <span class="badge badge-success">√</span>
        {/if}
      </td>
      <td><a href={$href}>{$question.question_name}</a>
      </td>
      <td>{$question.total_attempt_count == 0 ? 0 : $question.total_pass_count / $question.total_attempt_count * 100}%</td>
      <td>
        {switch $question.difficulty}
          {case 0}<span class="badge badge-success">简单</span>{/case}
          {case 1}<span class="badge badge-warning">中等</span>{/case}
          {case 2}<span class="badge badge-danger">困难</span>{/case}
        {/switch}
      </td>
    </tr>

    {/foreach}
    </tbody>
  </table>
  <hr>
  <nav aria-label="Page navigation example" style="position: fixed;bottom: 0">
    <ul class="pagination">
      <li class="page-item">
        <a class="page-link" href="#" aria-label="Previous">
          <span aria-hidden="true">&laquo;</span>
        </a>
      </li>
      {for start="1" end="$count / 15 + 1"}
      <?php $pagehref = "../question.QuestionController/getQuestionList?page=" . $i . "&uid=" . $uid; ?>
      <li class="page-item"><a class="page-link" href="{$pagehref}">{$i}</a></li>
      {/for}
      <li class="page-item">
        <a class="page-link" href="#" aria-label="Next">
          <span aria-hidden="true">&raquo;</span>
        </a>
      </li>
    </ul>
  </nav>
</div>

</body>
<script>



</script>

</html>
